<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red {
            width: 400px;
            height: 400px;
            background-color: red;
        }

        .green {
            width: 300px;
            height: 300px;
            background-color: green;
        }

        .blue {
            width: 200px;
            height: 200px;
            background-color: blue;
        }
    </style>
</head>

<body>
    <div class="red">
        <div class="green">
            <div class="blue"></div>
        </div>
    </div>

    <script>
        let red = document.querySelector('.red')
        let green = document.querySelector('.green')
        let blue = document.querySelector('.blue')


        // red.onclick = function () {
        //     console.log('red');

        // }
        // red.onclick = function () {
        //     console.log('red2');

        // }
        red.addEventListener('click', () => {
            console.log('red');
        })
        red.addEventListener('click', () => {
            console.log('red2');
        })
        // red.onclick = function () {
        //     console.log('red');
        // }
        // green.onclick = function () {
        //     console.log('green');

        // }
        // blue.onclick = function () {
        //     console.log('blue');
        // }
    </script>
</body>

</html>